package com.onion.utils.surface;

/**
 * 分页参数
 */
public class PageVo implements java.io.Serializable{

    private static final long serialVersionUID = 5753935611218665490L;

    public static final int DEFAULT_PAGE_SIZE = 10;

    public static PageVo instance(int pageNo, int pageSize){
        PageVo pageVo = new PageVo();
        pageVo.setPageNo(pageNo);
        pageVo.setPageSize(pageSize);
        return pageVo;
    }

    private int pageNo = 1;
    private int pageSize = DEFAULT_PAGE_SIZE;
    private int total;

    public int getPageNo(){
        return this.pageNo;
    }
    public void setPageNo(int pageNo){
        this.pageNo = pageNo;
    }

    public int getOffset() {
        if(pageNo > 0){
            return (pageNo-1) * pageSize;
        }else{
            return 0;
        }
    }

    public int getPageSize() {
        return pageSize;
    }
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotal() {
        return total;
    }
    public void setTotal(int total) {
        this.total = total;
    }

}